package com.xiaoshuidi.cloud.module.rooms.api.apartment;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.rooms.api.apartment.dto.ApartmentListDto;
import com.xiaoshuidi.cloud.module.rooms.api.apartment.vo.ApartmentListRespVO;
import com.xiaoshuidi.cloud.module.rooms.api.apartment.vo.GetApartmentVO;
import com.xiaoshuidi.cloud.module.rooms.api.apartment.vo.RecommendApartmentInfoRespVO;
import com.xiaoshuidi.cloud.module.rooms.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author Feng
 * @date 2023/5/23
 */
@FeignClient(name = ApiConstants.SERVERNAME)
@Tag(name = "RPC接口 - 门店相关接口")
public interface ApartmentApi {

    String PREFIX = ApiConstants.PREFIX + "/apartment";

    @PostMapping(PREFIX + "/create")
    @Operation(summary = "创建门店")
    public CommonResult<Long> create(@RequestParam("deptId") Long deptId, @RequestParam("apartmentName") String apartmentName);

    @GetMapping(PREFIX + "/listByIds")
    @Operation(summary = "获取门店列表")
    @Parameter(name = "ids", description = "门店ID", example = "1024", required = true)
    CommonResult<List<ApartmentListDto>> listByIds(@RequestParam("ids") List<Long> ids);

    @GetMapping(PREFIX + "/getById")
    @Operation(summary = "获取门店详情")
    @Parameter(name = "id", description = "门店ID", example = "1024", required = true)
    CommonResult<ApartmentListDto> getById(@RequestParam("id") Long id);

    @DeleteMapping(PREFIX + "/delete-by-deptId")
    @Operation(summary = "删除门店")
    @Parameter(name = "deptId", description = "部门ID", example = "1024", required = true)
    public CommonResult<Boolean> deleteByDeptId(@RequestParam("deptId") Long deptId);

    @PutMapping(PREFIX + "/edit-apartment-name")
    @Parameters({
            @Parameter(name = "deptId", description = "部门id"),
            @Parameter(name = "name", description = "门店名")
    })
    @Operation(summary = "编辑门店名称")
    public CommonResult<Long> editApartmentName(@RequestParam("deptId") Long deptId,@RequestParam("name") String name);

    @Operation(summary = "社区-获取推荐门店的信息")
    @Parameters({
            @Parameter(name = "apartmentIds", description = "门店id列表"),
            @Parameter(name = "lat", description = "用户纬度"),
            @Parameter(name = "lon", description = "用户经度"),
    })
    @GetMapping(PREFIX + "/recommend-apartment-info")
    public CommonResult<List<RecommendApartmentInfoRespVO>> recommendApartmentInfo(@RequestParam("apartmentIds") List<Long> apartmentIds, @RequestParam(value = "lat", required = false) String lat, @RequestParam(value = "lon", required = false) String lon);

    @Operation(summary = "社区-根据name模糊查询推荐门店的信息")
    @Parameter(name = "apartmentName", description = "门店名")
    @GetMapping(PREFIX + "/recommend-apartment-info-by-name")
    public CommonResult<List<RecommendApartmentInfoRespVO>> recommendApartmentInfoByName(@RequestParam("apartmentName") String apartmentName);

    @Operation(summary = "获取所有门店")
    @GetMapping(PREFIX + "/recommend-apartment-all-list")
    public CommonResult<List<ApartmentListRespVO>> apartmentAllList();

    @Operation(summary = "根据门店名称查询记录")
    @GetMapping(PREFIX + "/queryApartmentByName")
    CommonResult<ApartmentListDto> queryApartmentByName(@RequestParam("apartmentName")String apartmentName);


    @Operation(summary = "获取全部门店信息")
    @GetMapping(PREFIX + "/get-all-apartment")
    public CommonResult<List<GetApartmentVO>> getAllApartment();
}
